var app = new Vue({
    el: "#app",
    data: {
        query: "",
        musicList: [],
        musicUrl: "",
        coverUrl: "",
        comments: [],
        isPlaying: false,
        mvUrl: "",
        isShowing: false
    },
  methods: {
      
        searchMusic: function () {
            var that = this;
            axios.get("https://autumnfish.cn/search?keywords=" + this.query).then(function (response) {
                console.log(response.data.result.songs);
                that.musicList = response.data.result.songs;
            }, function (err) {})
        },
        playMusic: function (musicId) {
            var that = this;
            axios.get("https://autumnfish.cn/song/url?id=" + musicId).then(function (response) {
                console.log(response);
                that.musicUrl = response.data.data[0].url;
            }, function (err) {})

            axios.get("https://autumnfish.cn/song/detail?ids=" + musicId).then(function (response) {
                // console.log(response);
                that.coverUrl = response.data.songs[0].al.picUrl;
            }, function (err) {})

            axios.get("https://autumnfish.cn/comment/hot?type=0&id=" + musicId).then(function (response) {
                // console.log(response);
                that.comments = response.data.hotComments;
            }, function (err) {})
        },
        play: function () {
            this.isPlaying = true;
        },
        pause: function () {
            this.isPlaying = false;
        },
        playMv: function (mvId) {
            var that = this;
            axios.get("https://autumnfish.cn/mv/url?id=" + mvId).then(function (response) {
                // console.log(response);
                that.mvUrl = response.data.data.url;
                that.isShowing = true;
                that.$refs.audios.pause();
            }, function (err) {})
        },
        hide: function () {
            this.isShowing = false;
            this.mvUrl = "";
        }
    }
})